home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.01 Jan 91 / Object Design / line feed removal / CRemoveLFPane.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-23  |  2.9 KB  |  120 lines  |  [TEXT/KAHL]

  1. /****
  2.  * CRemoveLFPane.c
  3.  *
  4.  *    Pane methods for a typical application.
  5.  *
  6.  *    Most applications will want a scrollable window, so this
  7.  *    class is based on the class CPanorama. All the methods here
  8.  *    would still apply to classes based directly on CPane.
  9.  *
  10.  ****/
  11.  
  12. #include "CRemoveLFPane.h"
  13.  
  14.  
  15. void CRemoveLFPane::IRemoveLFPane(CView *anEnclosure, CBureaucrat *aSupervisor,
  16.                             short aWidth, short aHeight,
  17.                             short aHEncl, short aVEncl,
  18.                             SizingOption aHSizing, SizingOption aVSizing)
  19. {
  20.     CPanorama::IPanorama(anEnclosure, aSupervisor, aWidth, aHeight,
  21.                             aHEncl, aVEncl, aHSizing, aVSizing);
  22. }
  23.  
  24. /***
  25.  * Draw
  26.  *
  27.  *    In this method, you draw whatever you need to display in
  28.  *    your pane. The area parameter gives the portion of the 
  29.  *    pane that needs to be redrawn. Area is in frame coordinates.
  30.  *
  31.  ***/
  32.  
  33. void CRemoveLFPane::Draw(Rect *area)
  34.  
  35. {
  36.     /* draw your stuff */
  37. }
  38.  
  39.  
  40. /***
  41.  * DoClick
  42.  *
  43.  *    The mouse went down in the pane.
  44.  *    In this method you do whatever is appropriate for your
  45.  *    application. HitPt is given in frame coordinates. The other
  46.  *    parameters, modiferKeys and when, are taken from the event
  47.  *    record.
  48.  *
  49.  *    If you want to implement mouse tracking, this is the method
  50.  *    to do it in. You need to create a subclass of CMouseTask and
  51.  *    pass it in a TrackMouse() message to the pane.
  52.  *
  53.  ***/ 
  54.  
  55. void CRemoveLFPane::DoClick(Point hitPt, short modifierKeys, long when)
  56.  
  57. {
  58.     /* what happens when the mouse goes down */
  59. }
  60.  
  61.  
  62. /***
  63.  * HitSamePart
  64.  *
  65.  *    Test whether pointA and pointB are in the same part.
  66.  *    "The same part" means different things for different applications.
  67.  *    In the default method, "the same part" means "in the same pane."
  68.  *    If you want a different behavior, override this method. For instance,
  69.  *    two points might be in the same part if they're within n pixels
  70.  *    from each other.
  71.  *
  72.  *    PointA and pointB are both in frame coordinates.
  73.  *
  74.  ***/
  75.  
  76. Boolean     CRemoveLFPane::HitSamePart(Point pointA, Point pointB)
  77.  
  78. {
  79.     return inherited::HitSamePart(pointA, pointB);
  80. }
  81.  
  82.  
  83. /***
  84.  * AdjustCursor
  85.  *
  86.  *    If you want the cursor to have a different shape in your pane,
  87.  *    do it in this method. If you want a different cursor for different
  88.  *    parts of the same pane, you'll need to change the mouseRgn like this:
  89.  *        1. Create a region for the "special area" of your pane.
  90.  *        2. Convert this region to global coordinates
  91.  *        3. Set the mouseRgn to the intersection of this region
  92.  *           and the original mouseRgn: SectRgn(mouseRgn, myRgn, mouseRgn);
  93.  *
  94.  *    The default method just sets the cursor to the arrow. If this is fine
  95.  *    for you, don't override this method.
  96.  *
  97.  ***/
  98.  
  99. void CRemoveLFPane::AdjustCursor(Point where, RgnHandle mouseRgn)
  100.  
  101. {
  102.     inherited::AdjustCursor(where, mouseRgn);
  103. }
  104.  
  105.  
  106. /***
  107.  * ScrollToSelection
  108.  *
  109.  *    If your pane is based on a Panorama (as this example is), you might
  110.  *    want to define what it means to have a selection and what it means to
  111.  *    scroll to that selection.
  112.  *
  113.  ***/
  114.  
  115. void CRemoveLFPane::ScrollToSelection(void)
  116.  
  117. {
  118.     /* scroll to the selection */
  119. }
  120.